<?php

namespace Modules\Admin\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class AdminCreateRequest extends FormRequest
{
    /**
     * php artisan module:make-request AdminRequest Admin
     */
      
    public function authorize()
    {
        return true;
    }
	public function rules()
    {
        return [
			'group_id' => 'is_positive_integer',
            'username' => 'required|unique:admins|regex:/^[a-zA-Z0-9_-]{4,14}$/',
            'password'  => 'required|confirmed|regex:/^[a-zA-Z0-9_-]{4,14}$/'
			
        ];
    }
	public function messages(){ 
		return [
			'group_id.is_positive_integer' => '请选择所属权限组！',
			'username.required' => '请输入用户名！',
			'username.unique' => '用户名已存在！',
			'username.regex' => '用户名必须4到14位！',	
			'password.required' => '请输入密码！',
			'password.confirmed' => '两次密码输入不一致！',
			'password.regex' => '密码必须4到14位！',
			
		];
	}
}









